Exercise 8.1

Figure 8.31 shows the ACFs for 36 random numbers, 360 random numbers and 1,000 random numbers.

Left: ACF for a white noise series of 36 numbers. Middle: ACF for a white noise series of 360 numbers. Right: ACF for a white noise series of 1,000 numbers.

Left: ACF for a white noise series of 36 numbers. Middle: ACF for a white noise series of 360 numbers. Right: ACF for a white noise series of 1,000 numbers.

a. Explain the differences among these figures. Do they all indicate that the data are white noise?

It seems that the larger or longer the time series the closer the critical values for autocorrelation get to zero since the range of values that show no significant difference from 0 (between the blue lines) gets successively narrower as the number of data points increases in each plot.

All of the plots look like white noise since almost none of the plots extend beyond the critical values and there is no discernible pattern in the plots.

b. Why are the critical values at different distances from the mean of zero? Why are the autocorrelations different in each figure when they each refer to white noise?

From Hyndman:

For a white noise series, we expect 95% of the spikes in the ACF to lie within \(\pm 2/\sqrt{T}\) where \(T\) is the length of the time series.1

Since the critical values are dependent on \(T\) the longer the time series, the smaller the absolute value of the critical values will be.

Exercise 8.2

A classic example of a non-stationary series is the daily closing IBM stock price series (data set ibmclose). Use R to plot the daily closing prices for IBM stock and the ACF and PACF. Explain how each plot shows that the series is non-stationary and should be differenced.

Time Plot

A downward trend is clearly evident in the time plot which would rule out stationarity.

The ACF plot shows that all lags are well outside the range between the critical values that would indicate that the series is not white noise and so not stationary.

Because the first lag of a PACF plot is the same as the first lag in the ACF plot, the PACF plot also shows a significant spike at lag 1 that indicates that the series is not stationary.

Exercise 8.3

For the following series, find an appropriate Box-Cox transformation and order of differencing in order to obtain stationary data.

  • usnetelec
  • usgdp
  • mcopper
  • enplanements
  • visitors

In homework 2 we examined box-cox transformations for the first four of these series and discovered that "The enplanements series is the only one of the four that shows a clear seasonality that increases with the increase in the level of the series, so it is the only one of the four series for which a Box-Cox transformation is warranted and useful.2 So we will only use a box-cox transformation on the enplanements time series and possibly the visitors time series if it seems warranted after examining plots to look for increasing seasonality.

usnetelec

Description: Annual US net electricity generation (billion kwh) for 1949-2003

## [1] 1

We still see a lot of variation after differencing only once and there is one negative spike that extends below the critical value at lag 14 so let’s see if a second difference is better.

Not surprisingly, since the ndiffs function suggested only first-order differencing, that made things even worse, so let’s see if a log transformation or box-cox transformation helps in this case even though a box-cox transformation did not seem warranted.

## [1] 2

The ndiffs function suggested second-order differencing after a log transformation, but that made things worse again, so let’s try the Box-Cox transformation…

## [1] 2

Interesting! Even though a Box-Cox transformation did not seem warranted in this case based on plots, after trial and error the best solution for making the usnetelec time series stationary seems to be a Box-Cox transformation with first-order differencing even though the ’ndiffs` function suggested second-order differencing with Box-Cox! However it’s only marginally better than simple first-order differencing, so for simplicity’s sake we may choose to go with the original first-order differencing only instead.

usgdp

Description: Quarterly US GDP. 1947:1 - 2006.1.

## [1] 2

After my experience with the usnetelec series, I decided to try log transformation and Box-Cox too just in case, but second-order differencing alone resulted in the best outcome.

mcopper

Description: Monthly copper prices. Copper, grade A, electrolytic wire bars/cathodes,LME,cash (pounds/ton)

Source: UNCTAD http://stats.unctad.org/Handbook.

## [1] 1

Once again I tried log transformation and Box-Cox too just in case but again first-order differencing alone resulted in the best outcome.

enplanements

Description: "Domestic Revenue Enplanements (millions): 1996-2000.

Source: Department of Transportation, Bureau of Transportation Statistics, Air Carrier Traffic Statistic Monthly.

Here we can see a Box-Cox transformation is definitely warranted because we can see seasonal variability that increases with the increase in level.

## [1] 1
## [1] 1

The nsdiffs function recommended seasonal differencing after the Box-Cox transformation, and the ndiffs function recommends further first-order differencing which results in the following series…

visitors

Description: Monthly Australian short-term overseas visitors. May 1985-April 2005

Source: Hyndman, R.J., Koehler, A.B., Ord, J.K., and Snyder, R.D., (2008) Forecasting with exponential smoothing: the state space approach, Springer.

Again a Box-Cox transformation definitely seems to be warranted in this case due to seasonal variability that increases with the level of the series.

## [1] 1
## [1] 1

Once again, the nsdiffs function recommended seasonal differencing after the Box-Cox transformation, and the ndiffs function recommends further first-order differencing which results in the following series…

Exercise 8.5

For your retail data (from Exercise 3 in Section 2.10), find the appropriate order of differencing (after transformation if necessary) to obtain stationary data.

A Box-Cox transformation definitely seems to be warranted due to seasonal variability that increases with the level of the series.

## [1] 1
## [1] 1

Same as the last two time series in Exercise 8.3, the nsdiffs function recommended seasonal differencing after the Box-Cox transformation, and the ndiffs function recommends further first-order differencing which results in the following series…

There’s still a lot of autocorrelation in the ACF plot, but after trying a second-order seasonal dfference and second-order dfference after the seasonal differencing the plot above is still best.

Exercise 8.6

Use R to simulate and plot some data from simple ARIMA models.

  1. Use the following R code to generate data from an AR(1) model with \(\phi_1 = 0.6\) and \(\sigma^2 = 1\). The process starts with \(y_1 = 0\).
  1. Produce a time plot for the series. How does the plot change as you change \(\phi_1\)?

  1. Write your own code to generate data from an MA(1) model with \(\theta_1 = 0.6\) and \(\sigma^2 = 1\).
  1. Produce a time plot for the series. How does the plot change as you change \(\theta_1\)?

  1. Generate data from an ARMA(1,1) model with \(\phi_1 = 0.6\), \(\theta_1 = 0.6\) and \(\sigma^2 = 1\).
  1. Generate data from an AR(2) model with \(\phi_1 = -0.8\), \(\phi_2 = 0.3\) and \(\sigma^2 = 1\). (Note that these parameters will give a non-stationary series.)
  1. Graph the latter two series and compare them.

Exercise 8.7

Consider wmurders, the number of women murdered each year (per 100,000 standard population) in the United States.

  1. By studying appropriate graphs of the series in R, find an appropriate \(\text{ARIMA}(p,d,q)\) model for these data.

  2. Should you include a constant in the model? Explain.

  3. Write this model in terms of the backshift operator.

  4. Fit the model using R and examine the residuals. Is the model satisfactory?

  5. Forecast three times ahead. Check your forecasts by hand to make sure that you know how they have been calculated.

  6. Create a plot of the series with forecasts and prediction intervals for the next three periods shown.

  7. Does auto.arima() give the same model you have chosen? If not, which model do you think is better?

Footnotes


  1. Hyndman, R.J., & Athanasopoulos, G. (2018) Forecasting: principles and practice, 2nd edition, OTexts: Melbourne, Australia. OTexts.com/fpp2. Accessed on February 23, 2020.

  2. https://rpubs.com/betsyrosalen/DATA624_HW2